package com.shop.cereshop.business.controller;

import com.shop.cereshop.business.service.shop.CereShopConversionService;
import com.shop.cereshop.business.utils.ContextUtil;
import com.shop.cereshop.commons.constant.CoReturnFormat;
import com.shop.cereshop.commons.domain.shop.CereShopConversion;
import com.shop.cereshop.commons.domain.shop.bo.CereShopConversionBo;
import com.shop.cereshop.commons.domain.shop.bo.CereShopSkuBo;
import com.shop.cereshop.commons.domain.shop.vo.CereShopConversionVo;
import com.shop.cereshop.commons.exception.CoBusinessException;
import com.shop.cereshop.commons.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 店铺信息转化模块
 */
@RestController
@RequestMapping("/conversion")
/**
 * 注解方式生成日志对象，指定topic生成对象类名
 */
@Slf4j(topic = "CereShopConversionController")
@Api(value = "店铺信息转化模块", tags = "店铺信息转化模块")
public class CereShopConversionController {

    @Autowired
    private CereShopConversionService cereShopConversionService;

    @PostMapping("/queryList")
    @ApiOperation(value = "查询店铺转化信息")
    public Result<List<CereShopConversionVo>> queryList(@RequestBody CereShopConversionBo bo, HttpServletRequest request)throws CoBusinessException {
        Long shopId = ContextUtil.getShopId();
        bo.setShopId(shopId);
        List<CereShopConversionVo> cereShopConversionVos = cereShopConversionService.queryList(bo);
        return new Result<>(cereShopConversionVos, CoReturnFormat.SUCCESS);
    }
}
